﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ArrayListTest
{
    public class Person : IComparable
    {
        public Person() { }
        public Person(string name, string sex)
        {
            this.Name = name;
            this.Sex = sex;
        }
        public string Name;
        public string Sex;

        public override string ToString()
        {
            return this.Name + " " + this.Sex;
        }
        #region IComparable 成员
        public int CompareTo(object obj)
        {
            Person p = obj as Person;
            if (p == null)
            {
                throw new NotImplementedException();
            }
            return this.Name.CompareTo(p.Name);
        }
        #endregion
    }
}
